package com.example.controller;

import java.util.Scanner;

public class Solution_excel2003 {

	 
	public int Find(String str)
	{
 
		char[] strArr = str.toCharArray();
		int exp = 0;
		int sum = 0;
		for (int i = strArr.length - 1; i >= 0; i--)
		{
			int num = strArr[i] - 'A' + 1;
			sum += num * ((int) Math.pow(26, exp));
			exp++;
		}
		return sum;
	}
 
	/**
	 * @param args
	 */
	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Scanner sc = new Scanner("AK");
		while (sc.hasNext())
		{
			String str = sc.nextLine();
			Solution_excel2003 find = new Solution_excel2003();
			System.out.println(find.Find(str)-1);
		}
	}

}
